<?php

class Sistema_Form_Pagina extends Zend_Form {

    
    public function init() 
    {
   	    
        $front = Zend_Controller_Front::getInstance();
        $controller = $front->getRequest()->getControllerName();
        $module = $front->getRequest()->getModuleName();
        $url = $front->getBaseUrl().'/'.$module.'/'.$controller;

        $el = new Zend_Form_Element_Hidden('PAG_ID',array('disableLoadDefaultDecorators' =>true));
        $el->addDecorators(array(array('ViewHelper'),array('Errors')))
            ->addFilter('Int');
        $this->addElement($el);

        $el = new Zend_Form_Element_Text('PAG_TITULO');
        $el->setLabel('Título')
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        $this->addElement($el);
        
        $el = new Zend_Form_Element_Textarea('PAG_RESUMO');
        $el->setLabel('Resumo')
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        //$this->addElement($el);
        
        $el = new Zend_Form_Element_Textarea('PAG_TEXTO');
        $el->setLabel('Texto')
                ->setRequired(true)
               //->addFilter('StripTags')
               //->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        $this->addElement($el);
        
          
        $btn = new Zend_Form_Element_Submit('submit',array('disableLoadDefaultDecorators' =>true));
        $btn->addDecorators(array(array('ViewHelper'),array('Errors')));
        $btn->setAttrib('id', 'submitbutton');
        $btn->setAttrib('class', 'btn-button btn-ok');
        $this->addElement($btn);
        
        $btn = new Zend_Form_Element_Button('Cancelar',array('disableLoadDefaultDecorators' =>true));
        //$btn->addDecorators(array(array('ViewHelper'),array('Errors')));
        $btn->setDecorators(array(array('Description', array('escape' => false, 'tag' => false))));
        $btn->setDescription('<a href="'.$url.'" class="btn-button btn-cancel">Cancelar</a>');
        $btn->setAttrib('id', 'btncancel');
        $btn->setAttrib('class', 'btn-button btn-cancel');
        $this->addElement($btn);
        
        
    }

}

